import request from "@/utils/http";
import { DataStructure } from "./preWarning";
interface LoginParams {
  openId: string;
  phone: string;
  token: string;
  userId: string;
  userName: string;
}
export interface UserListParmas {
  pageSize?: number;
  pageNum?: number;
  phone?: string;
  username?: string;
}
/**
 * 登录接口
 */
export const userLogin = (params: any) => {
  return request.post<LoginParams>("/account/login", params, {
    headers: { noLoading: true },
  });
};
// 退出登录
export const logout = () => {
  return request.get("/account/logout");
};
// 用户列表
export const getUserList = (params: UserListParmas) => {
  return request.get<DataStructure>("/app/users", params);
};
// 添加用户
export const addUser = (params: UserListParmas) => {
  return request.post<any>("/app/users", params);
};
// 编辑用户
export const editUser = (params: UserListParmas) => {
  return request.put<any>("/app/users", params);
};
// 删除用户
export const deleteUser = (params: string) => {
  return request.delete<any>("/app/users", params);
};
